Skip to content

fix(interpreter): set -e should not trigger on compound commands with && chain failure#879

Merged
chaliy merged 6 commits intomainfrom
fix/873-set-e-compound-commands
Mar 27, 2026
Merged

fix(interpreter): set -e should not trigger on compound commands with && chain failure#879
chaliy merged 6 commits intomainfrom
fix/873-set-e-compound-commands

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

Summary

  • Check result.errexit_suppressed in execute_script_body() so compound commands (for/while/until) whose body ends with an AND-OR chain failure do not incorrectly trigger errexit
  • The flag was already propagated by execute_for and execute_condition_loop, but execute_script_body only checked for Command::List and negated pipelines

Fixes #873

Test plan

  • set_e_for_loop_and_chain_no_exit — exact reproduction from issue
  • set_e_while_loop_and_chain_no_exit — while loop variant
  • set_e_plain_failure_in_loop_still_exits — ensures set -e still works for non-AND-OR failures
  • All 9 existing set_e_and_or_tests pass
  • Full test suite passes

@chaliy chaliy merged commit d4839ac into main Mar 27, 2026
23 checks passed
@chaliy chaliy deleted the fix/873-set-e-compound-commands branch March 27, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set -e incorrectly triggers on compound commands whose body ends with && chain failure

1 participant